<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./lib/react.development.js"></script>
    <script src="./lib/react-dom.development.js"></script>
</head>

<body>
    <div id="app"></div>

    <script>
        //1.创建虚拟DOM
        //React.createElement(标签的名字，标签的属性，标签的内容)

        //class 在JS中不是关揵字就是保留字 在react中所有的class 都要写出className
        //tabindex => tabIndex
        let btnClick = function () {
            alert('nihao')
        }
        // let oDiv = React.createElement('div', null, "Hello React")
        let oSpan = React.createElement('span', null, '我是Div中的span')
        let oDiv = React.createElement('div', { title: "我是title", className: 'box', onClick: btnClick }, "Hello React", oSpan)

        //2.把虚拟DOM渲染到真实的页面上
        //ReactDOM.render(虚拟dom，挂载到哪个元素上)
        ReactDOM.render(oDiv, document.getElementById('app'))

        ReactDOM.render(oSpan, document.getElementById('app'))
    </script>
</body>

</html>